package com.yang.crawler.event.factory;

import com.yang.crawler.event.IEventHandler;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class EventHandlerFactory {
    private static final Map<String, IEventHandler> eventHandlerFactory = new ConcurrentHashMap<>();

    public static void registerEventHandler(String eventName, IEventHandler eventHandler) {
        eventHandlerFactory.put(eventName, eventHandler);
    }

    public static IEventHandler getEventHandler(String eventName) {
        return eventHandlerFactory.get(eventName);
    }
}